import { sha256 } from '@src/utils/security';
import request from './index';
import { LOGIN_TYPE } from '@src/const';

// 获取直播间或者直播信息
export default function login(type: LOGIN_TYPE, userInfo: any) {
  const data = {
    ...userInfo,
  };

  if (userInfo.password) {
    data.password = sha256(userInfo.password);
  }

  return request({
    method: 'post',
    url: '/account/login',
    data: {
      data,
      type,
    },
  });
}
